package com.atguigu.exam;

/**
 * @author xbd
 * @create 2021-05-25 18:26
 */
public class ReversTest {
    public static void main(String[] args) {
        ReversTest r1 = new ReversTest();
        System.out.println(r1.reversString("abcdefg", 2, 5));
    }
    public String reversString(String string, int start, int end){
        String str1 = string.substring(0,start);
        for (int i = end; i >= start; i--) {
            char c = string.charAt(i);
            str1 += c;
        }
        str1 += string.substring(end + 1);
        return str1;
    }
}
